1 <?php
2 session_start();
3 error_reporting(
0);
4 include(
'includes/config.php');
5 if
(strlen($_SESSION['login'])==0)
6     {
7 header(
'location:index.php');
8 }

9 else
{
10 if
(isset($_REQUEST['bkid']))
11     {
12         $bid=intval($_GET[
'bkid']);
13 $email=$_SESSION[
'login'];
14     $sql =
"SELECT FromDate FROM tblbooking WHERE UserEmail=:email and BookingId=:bid";
15 $query= $dbh -> prepare($sql);
16 $query-> bindParam(
':email', $email, PDO::PARAM_STR);
17 $query-> bindParam(
':bid', $bid, PDO::PARAM_STR);
18 $query-> execute();
19 $results = $query -> fetchAll(PDO::FETCH_OBJ);

20 if
($query->rowCount() > 0)
21 {

22 foreach
($results as $result)
23 {
24      $fdate=$result->FromDate;
25
26     $a=explode(
"/",$fdate);
27     $val=array_reverse($a);
28      $mydate =implode(
"/",$val);
29     $cdate=date(
'Y/m/d');
30     $date1=date_create(
"$cdate");
31     $date2=date_create(
"$fdate");
32  $diff=date_diff($date1,$date2);
33 echo $df=$diff->format(
"%a");
34 if
($df>1)
35 {
36 $status=
2;
37 $cancelby=
'u';
38 $sql =
"UPDATE tblbooking SET status=:status,CancelledBy=:cancelby WHERE UserEmail=:email and BookingId=:bid";
39 $query = $dbh->prepare($sql);
40 $query -> bindParam(
':status',$status, PDO::PARAM_STR);
41 $query -> bindParam(
':cancelby',$cancelby , PDO::PARAM_STR);
42 $query-> bindParam(
':email',$email, PDO::PARAM_STR);
43 $query-> bindParam(
':bid',$bid, PDO::PARAM_STR);
44 $query -> execute();
45
46 $msg=
"Booking Cancelled successfully";
47 }

48 else

49 {
50 $error=
"You can't cancel booking before 24 hours";
51 }
52 }
53 }
54 }
55
56 ?>
57 <!DOCTYPE HTML>
58 <html>
59 <head>
60 <title>TMS | Tourism Management System</title>
61 <meta name=
"viewport" content="width=device-width, initial-scale=1">
62 <meta http-equiv=
"Content-Type" content="text/html; charset=utf-8" />
63 <meta name=
"keywords" content="Tourism Management System In PHP" />
64 <script type=
"applijewelleryion/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
65 <link href=
"css/bootstrap.css" rel='stylesheet' type='text/css' />
66 <link href=
"css/style.css" rel='stylesheet' type='text/css' />
67 <link href=
'//fonts.googleapis.com/css?family=Open+Sans:400,700,600' rel='stylesheet' type='text/css'>
68 <link href=
'//fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300' rel='stylesheet' type='text/css'>
69 <link href=
'//fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
70 <link href=
"css/font-awesome.css" rel="stylesheet">
71 <!-- Custom Theme files -->
72 <script src=
"js/jquery-1.12.0.min.js"></script>
73 <script src=
"js/bootstrap.min.js"></script>
74 <!--animate-->
75 <link href=
"css/animate.css" rel="stylesheet" type="text/css" media="all">
76 <script src=
"js/wow.min.js"></script>
77     <script>
78          
new WOW().init();
79     </script>
80
81   <style>
82         .errorWrap {
83     padding: 10px;
84     margin:
0 0 20px 0;
85     background: #fff;
86     border-left: 4px solid #dd3d36;
87     -webkit-box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
88     box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
89 }
90 .succWrap{
91     padding: 10px;
92     margin:
0 0 20px 0;
93     background: #fff;
94     border-left: 4px solid #5cb85c;
95     -webkit-box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
96     box-shadow:
0 1px 1px 0 rgba(0,0,0,.1);
97 }
98         </style>
99 </head>
100 <body>
101 <!-- top-header -->
102 <div
class="top-header">
103 <?php include(
'includes/header.php');?>
104 <div
class="banner-1 ">
105     <div
class="container">
106         <h1
class="wow zoomIn animated animated" data-wow-delay=".5s" style="visibility: visible; animation-delay: 0.5s; animation-name: zoomIn;">TMS-Tourism Management System</h1>
107     </div>
108 </div>
109 <!--- /banner-
1 ---->
110 <!--- privacy ---->
111 <div
class="privacy">
112     <div
class="container">
113         <h3
class="wow fadeInDown animated animated" data-wow-delay=".5s" style="visibility: visible; animation-delay: 0.5s; animation-name: fadeInDown;">My Tour History</h3>
114         <form name=
"chngpwd" method="post" onSubmit="return valid();">
115          <?php
if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo htmlentities($error); ?> </div><?php }
116                 
else if($msg){?><div class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?>
117     <p>
118     <table border=
"1" width="100%">
119 <tr align=
"center">
120 <th>#</th>
121 <th>Booking Id</th>
122 <th>Package Name</th>
123 <th>From</th>
124 <th>To</th>
125 <th>Comment</th>
126 <th>Status</th>
127 <th>Booking Date</th>
128 <th>Action</th>
129 </tr>
130 <?php
131
132 $uemail=$_SESSION[
'login'];;
133 $sql =
"SELECT tblbooking.BookingId as bookid,tblbooking.PackageId as pkgid,tbltourpackages.PackageName as packagename,tblbooking.FromDate as fromdate,tblbooking.ToDate as todate,tblbooking.Comment as comment,tblbooking.status as status,tblbooking.RegDate as regdate,tblbooking.CancelledBy as cancelby,tblbooking.UpdationDate as upddate from tblbooking join tbltourpackages on tbltourpackages.PackageId=tblbooking.PackageId where UserEmail=:uemail";
134 $query = $dbh->prepare($sql);
135 $query -> bindParam(
':uemail', $uemail, PDO::PARAM_STR);
136 $query->execute();
137 $results=$query->fetchAll(PDO::FETCH_OBJ);
138 $cnt=
1;
139 if
($query->rowCount() > 0)
140 {

141 foreach
($results as $result)
142 { ?>
143 <tr align=
"center">
144 <td><?php echo htmlentities($cnt);?></td>
145 <td>#BK<?php echo htmlentities($result->bookid);?></td>
146 <td><a href=
"package-details.php?pkgid=<?php echo htmlentities($result->pkgid);?>"><?php echo htmlentities($result->packagename);?></a></td>
147 <td><?php echo htmlentities($result->fromdate);?></td>
148 <td><?php echo htmlentities($result->todate);?></td>
149 <td><?php echo htmlentities($result->comment);?></td>
150 <td><?php
if($result->status==0)
151 {
152 echo
"Pending";
153 }

154 if
($result->status==1)
155 {
156 echo
"Confirmed";
157 }

158 if
($result->status==2 and $result->cancelby=='u')
159 {
160 echo
"Canceled by you at " .$result->upddate;
161 }

162 if
($result->status==2 and $result->cancelby=='a')
163 {
164 echo
"Canceled by admin at " .$result->upddate;
165
166 }
167 ?></td>
168 <td><?php echo htmlentities($result->regdate);?></td>
169 <?php
if($result->status==2)
170 {
171     ?><td>Cancelled</td>
172 <?php }
else {?>
173 <td><a href=
"tour-history.php?bkid=<?php echo htmlentities($result->bookid);?>" onclick="return confirm('Do you really want to cancel booking')" >Cancel</a></td>
174 <?php }?>
175 </tr>
176 <?php $cnt=$cnt+
1; }} ?>
177     </table>
178         
179             </p>
180             </form>
181
182         
183     </div>
184 </div>
185 <!--- /privacy ---->
186 <!--- footer-top ---->
187 <!--- /footer-top ---->
188 <?php include(
'includes/footer.php');?>
189 <!-- signup -->
190 <?php include(
'includes/signup.php');?>
191 <!--
//signu -->
192 <!-- signin -->
193 <?php include(
'includes/signin.php');?>
194 <!--
//signin -->
195 <!-- write us -->
196 <?php include(
'includes/write-us.php');?>
197 </body>
198 </html>
199 <?php } ?>


Gõ tìm kiếm nhanh...